<?php
/**
 * Create By: PhpStorm
 * User: niechenguang
 * File: Circle.php
 * Date: 2017/1/2
 * Time: 21:45
 */

namespace app\api\controller;

use app\api\model\page\circle\AddCircle as AddCircleModel;
use app\api\model\page\circle\AddCircleCate;
use app\api\model\page\circle\ApproveCircle as ApproveCircleModel;
use app\api\model\page\circle\CateCircle;
use app\api\model\page\circle\DelCircle;
use app\api\model\page\circle\DelCircleCate;
use app\api\model\page\circle\FollowCircle;
use app\api\model\page\circle\GetCircleInfo as GetCircleInfoModel;
use app\api\model\page\circle\GetCircleList as GetCircleListModel;
use app\api\model\page\circle\GetCircleRecommend as GetCircleRecommendModel;
use app\api\model\page\circle\GetCircleContribution as GetCircleContributionModel;

use app\api\model\page\circle\GetCircleUser;
use app\api\model\page\circle\GetMineCircleList;
use app\api\model\page\circle\UpdateCircle;
use app\api\model\page\user\Update;
use think\Request;

class Circle
{

    private $addCircleModel;
    private $getCircleInfoModel;
    private $getCircleListModel;
    private $getCircleRecommendModel;
    private $getCircleContributionModel;
    private $followCircle;
    private $mineCircle;

    protected $param;

    public function __construct()
    {
        $this->param = Request::instance()->param();

        $this->addCircleModel = new AddCircleModel();
        $this->getCircleInfoModel = new GetCircleInfoModel();
        $this->getCircleListModel = new GetCircleListModel();
        $this->getCircleRecommendModel = new GetCircleRecommendModel();
        $this->getCircleContributionModel = new GetCircleContributionModel();
        $this->followCircle = new FollowCircle();
        $this->mineCircle = new GetMineCircleList();
    }

    /**
     * 新建圈子审核
     *
     * @return array
     */
    public function applyCircle()
    {
        return $this->addCircleModel->excute($this->param);
    }

    /**
     * 修改圈子
     *
     * @return array
     */
    public function updateCircle()
    {
        $obj = new UpdateCircle();
        return $obj->excute($this->param);
    }

    /**
     * 获取圈子详情
     *
     * @return array
     */
    public function getCircleInfo()
    {
        return $this->getCircleInfoModel->excute($this->param);
    }

    /**
     * 获取圈子列表
     *
     * @return array
     */
    public function getCircleList()
    {
        return $this->getCircleListModel->excute($this->param);
    }

    /**
     * 获取我的圈子列表
     *
     * @return array
     */
    public function getMineCircleList()
    {
        return $this->mineCircle->excute($this->param);
    }

    /**
     * 获取圈子列表
     *
     * @return array
     */
    public function getCircleRecommend()
    {
        return $this->getCircleRecommendModel->excute($this->param);
    }

    /**
     * 获取圈子列表
     *
     * @return array
     */
    public function getCircleContribution()
    {
        return $this->getCircleContributionModel->excute($this->param);
    }

    /**
     * 关注圈子
     *
     * @return array
     */
    public function followCircle()
    {
        return $this->followCircle->excute($this->param);
    }

    /**
     * 获取圈子成员
     *
     * @return array
     */
    public function getCircleUser()
    {
        $obj = new GetCircleUser();
        return $obj->excute($this->param);
    }

    public function cateCircle()
    {
        $obj = new CateCircle();
        return $obj->excute($this->param);
    }

    public function delCircle()
    {
        $obj = new DelCircle();
        return $obj->excute($this->param);
    }

    public function addCircleCate()
    {
        $obj = new AddCircleCate();
        return $obj->excute($this->param);
    }

    public function delCircleCate()
    {
        $obj = new DelCircleCate();
        return $obj->excute($this->param);
    }
}
